#ifndef MotionState_H
#define MotionState_H

//a simple way to represent location and velocity information for objects not simulated in physics
class MotionState{
public:
	double x;
	double y;
	double z;
	double vx;
	double vy;
	double vz;
	/*
	double tx = 0;
	double ty = 0;
	double tz = 0;
	double wx = 0;
	double wy = 0;
	double wz = 0;
	*/

	MotionState() : x(0), y(0), z(0), vx(0), vy(0), vz(0) {}
	//go ahead and update position based on velocity
	void updatePosition(){
		x = x + vx;
		y = y + vy;
		z = z + vz;
		/*
		tx = tx + wx;
		ty = ty + wy;
		tz = tz + wz;
		*/
	}
	//add to the velocity
	void accelerate(double ax, double ay, double az){
		vx = vx + ax;
		vy = vy + ay;
		vz = vz + az;
	}
	//add a resistance to the velocity
	void accelerateResistance(double ax, double ay, double az){
		if(vx < 0){
			if(ax > (-vx)){
				vx = 0;
			}
			else{
				vx = vx + ax;
			}
		}
		else{
			if(ax > vx){
				vx = 0;
			}
			else{
				vx = vx - ax;
			}
		}
		if(vy < 0){
			if(ay > (-vy)){
				vy = 0;
			}
			else{
				vy = vy + ay;
			}
		}
		else{
			if(ay > vy){
				vy = 0;
			}
			else{
				vy = vy - ay;
			}
		}
		if(vz < 0){
			if(az > (-vz)){
				vz = 0;
			}
			else{
				vz = vz + az;
			}
		}
		else{
			if(az > vz){
				vz = 0;
			}
			else{
				vz = vz - az;
			}
		}
	}
	/*
	void accelerateAngular(double ax, double ay, double az){
		wx += ax;
		wy += ay;
		wz += az;
	}
	*/
};

#endif
